Repository navigation
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 23 files
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
This comment has been minimized.
This comment has been minimized.
c7646db to
9d3b49e
Compare
Size Report
Startup median (7 runs, lower is better):
|
|
Round 2 (9d3b49e) covers the security review's eight items and Cubic's four threads. The branch is rebased on main.
Cubic: neutral "Cloud base URL" subject; restored the |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 2 new findings on fa7fbfe. The verdict and the full list are in the summary comment.
fa7fbfe to
3fe1be5
Compare
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 2 new findings on 1809716. The verdict and the full list are in the summary comment.
|
e3e7fb4 closes the open items:
Not covered by this push: Revyl on a loopback http |
This comment has been minimized.
This comment has been minimized.
|
61eb773 closes the two gaps listed as open:
The description is shortened to meet the body word limit. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
The code at 3e9aeb4 needs changes before merge: one device route lacks live proof, and some paths can still leak a credential or break loopback and refusal behavior. The physical iOS route over the CoreDevice tunnel (device not attached by USB) changed in two ways at runner-transport.ts:112. It now refuses any A second independent pass found that the localhost exception likely trusts the name before the address is resolved (loopback-host.ts:14). If the system resolver maps A second independent pass found that the Metro companion likely forwards credential headers over unchecked plain HTTP (client-companion-tunnel-worker.ts:334). A valid A second independent pass found that proxy health, diagnostics and transfer refusals likely lose the transport reason (daemon-proxy.ts:964). With a non-loopback plain HTTP upstream, A second independent pass found that companion transport refusals likely end as a successful worker exit (client-companion-tunnel-worker.ts:201). When a bridge returns an off-loopback A second independent pass found that loopback Metro bridge requests likely lose same-origin redirects (client-metro.ts:464). On the base branch, a 307 to the canonical path was followed with the POST body and bearer. Now the direct requester returns the 307 unchanged, so Metro prepare treats bridge setup as failed. The companion's loopback register and unregister calls set no redirect policy either, so registration fails and unregistration can report completion without reaching the canonical path. Every Metro bridge POST should follow a bounded number of same-origin redirects, use direct transport on each loopback hop, and keep the method and body semantics. A second independent pass found that direct loopback requests likely expose compressed bytes to Could one host-kit primitive be the only way to send a credential? For example, Not blocking: these can be taken or left: making For a follow-up issue, not for this PR: the trust page says provider credentials never go over plain HTTP off loopback, but BrowserStack endpoint overrides (also the session details and app upload ones) reach WebDriver senders and helper fetches that never check the URL, so either check them or name what the rule covers and list WebDriver providers, install-from-source headers and the Limrun SDK client as not covered. CI is green: every non-skipped check passes, including Body rules (after a rerun) and the iOS and macOS smoke tests. Those smoke tests cover the simulator loopback runner route, not the CoreDevice tunnel. The Limrun forwarded route is a cloud provider path, and its fixture test is acceptable. Not verified here: no device was available, so it is unconfirmed that Before merge, the fixes above are needed, along with the live Wi-Fi-only iPhone run on the CoreDevice tunnel route. |
|
Re: review of 3e9aeb4. Addressed in 0285cf3. I took the suggested structure:
Non-blocking: taken are the check inside the primitive, the shared dispatch and status sets, the Breaking line about upstream redirects, the duplicate doc comment, and one direct socket agent closed on shutdown. Not taken: rejecting a bad The CoreDevice route has a test of the exact |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 1 new finding on 0aa77a6. The verdict and the full list are in the summary comment.
This comment has been minimized.
This comment has been minimized.
|
Live check on a physical iPhone over Wi-Fi only, at 678a0c6.
Note: the route and its source aren't logged, so the route evidence comes from the socket check rather than diagnostics. |
A remote daemon base URL with a token, the proxy's upstream daemon URL, the Metro host bridge URL, and the cloud auth base URL are refused before the first request when they use plain http to a host that is not loopback (insecure_credential_transport). An upload ticket that would carry a daemon credential over such a URL takes the legacy upload route. isLoopbackHostname moves to @agent-device/contracts/daemon-http so the proxy shares the same matcher. BREAKING CHANGE: http:// remote URLs to LAN or VPN hosts with a token no longer work. Use https, or a port forward to 127.0.0.1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- proxy: every upstream request carries redirect: 'error'; the upstream URL rule applies to custom transports too, checked on the first exchange; a plain-http upstream goes direct over node:http - direct connection for credential-bearing plain-http requests, so an environment proxy never sees a loopback token (daemon client, remote transfers and diagnostics, proxy transports) - cloud profile discovery checks the URL and follows redirects only on the same origin - metro bridge and the companion worker check each final URL before the bearer is sent; a malformed base is refused - upload tickets must be https or loopback, whatever carries the credential - Limrun API and download URLs and forwarded runner routes are checked at send time - the rule lives in @agent-device/contracts/credential-transport and the matcher in @agent-device/contracts/loopback-host; daemon-http stays free of error imports; revyl uses the shared matcher Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- declare the host-kit direct-http subpath in the pinned export surface - new tests use plain node:http servers where test-kit is not a dependency, and are named for the module they cover (R84) - move the new upload-ticket and connect-cloud cases into focused files under the max-lines cap; type the fetch stub's input - the upload cancellation test replaces the direct-http send, the seam loopback control requests now use - pass string URLs to fetch where callers compare them Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Six wire-surface request builders changed only how a request reaches the daemon: plain-http (loopback) destinations take a direct node:http agent that bypasses environment proxies, upload control requests to loopback use node:http instead of fetch, and preflight drops a ticket URL that is plain http off loopback (the legacy route a released daemon already serves). Method, path, headers and bodies are unchanged, so the ledger records the new digests with compatibleChanges entries; the existing acks for five of them carry the new digest and an appended rationale. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The direct request-diagnostics read sends the daemon token over plain http to loopback, so it takes the direct agent that bypasses environment proxies. The integration test now asserts that agent in the request options instead of a shape without one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Revyl sends loopback http through the direct requester, so an environment proxy never sees the API key, and refuses a presigned upload URL that is neither https nor loopback http - the Metro companion opens the registered bridge socket only over wss, or ws to loopback, and refuses it before the socket opens - a loopback bridge socket connects directly through undici, because the global WebSocket sends its URL to an environment proxy Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The sockets the test servers take on upgrade and connect had no error listener. Killing the spawned worker with its bridge socket open can reset it, which Linux CI reported as an unhandled ECONNRESET. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- proxy: drop a relayed Location whose serialized or decoded path holds the upstream token; refuse an upstream base URL with a username or password during admission - Limrun download: refuse the initial URL before the cleanup path, so an existing destination file stays - direct requester: pipe a streamed body instead of buffering it - bridge socket: only wss, or ws to loopback, by the original scheme - Apple runner: only the CoreDevice tunnel route may carry the token over plain http off loopback, and the docs say so Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- direct requester: release a streamed body when the exchange fails or never starts, including an abort before the request - Apple runner: treat a reported device address as the CoreDevice tunnel only when it is in fd00::/8, and say so in the security docs - proxy: refuse a username or password before the scheme check, so every scheme reports proxy_upstream_userinfo Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
fetchWithCredential applies the transport rule to every URL it sends to, sends plain http direct and follows only same-origin redirects. The node:http requester takes the URL and applies the same rule. - a localhost name connects only to loopback addresses, over HTTP and the companion socket - the companion relays only paths on the local base URL, sends relayed credentials under the rule, and fails with the typed refusal - proxy answers outside /rpc name the admission reason - Metro bridge and companion POSTs follow same-origin redirects again - the direct requester decodes gzip, deflate and br as fetch does - the trust page names what the rule covers Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The test bridge derived a redirect Location from the request URL. It now names each moved registration path itself. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Client abort and upstreamTimeoutMs end the exchange on the default plain-http transport, before an answer and during one. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Node keeps loopback destinations off environment proxies, so the direct node:http client protected against nothing. Remove it and go back to fetch and node:http as on main. Keep the one rule: a credential never travels over plain http or ws off loopback, and a redirect never carries it to another origin. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
678a0c6 to
572b141
Compare
|
Re: review of 3e9aeb4. The PR was simplified by maintainer decision at 572b141: the direct Resolved by returning to
Kept:
Also changed: a refused Limrun download redirect now reports |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 1 new finding on 572b141. The verdict and the full list are in the summary comment.
The companion refused every absolute relayed path, including one on the local base origin that it served before. Compare the resolved origin only, which still refuses another origin, absolute or scheme-relative. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
|
Live check on a physical iPhone over Wi-Fi only, at 071e33c (the simplified fetch-based head).
The route isn't logged, so the route evidence comes from the socket check. |
|
The code at 071e33c fixes most of the earlier findings on 3e9aeb4, but three redirect and relay problems need changes before merge. Now fixed: credential headers on relayed HTTP requests are checked for the named headers and other origins are refused, proxy refusals keep their transport reason, a companion transport refusal fails the worker, Metro bridge POSTs follow same-origin redirects for up to three hops, compressed responses are decoded again, and the shared helper now applies the transport rule itself. The Wi-Fi-only iPhone route is covered by the reported live run. The A second independent pass found that a refused Limrun download redirect likely discloses the signed URL. When a signed HTTPS download answers with a 307 to plain HTTP off loopback, nothing is sent to that destination, but the helper returns the 307. The download treats it as an ordinary HTTP error and puts the original URL and its signature in A second independent pass found that safe Limrun download chains likely stop after three redirects. With four same-origin HTTPS redirects before a 200, the base branch succeeds and 3e9aeb4 allowed five hops, but the shared hop limit now stops at the fourth 3xx, so the download fails and the destination file is removed. Every download request should keep the base A second independent pass found that the companion's relayed WebSocket can likely send a signed path over plain Could These open threads no longer apply and can be resolved: test server redirect, because the test server sets The only check that does not pass is Body rules, which was cancelled. It validates the PR description, no file in the diff is on its route, and it passed on an earlier head after a rerun. Not verified here: no repository tests were run, and the only local run was an inline Node 26.11.1 experiment on cross-origin redirect header stripping in Before merge, the three fixes are needed and Body rules must be rerun and pass. |
- Report a Limrun download redirect that is not followed with its status only: no URL, Location or body. - Give Limrun downloads their own 20-hop limit, the one fetch applies. Fetch's own follow is not used there: it follows https to plain http. - Check every relayed Metro WebSocket URL before the socket is built. - Delete fetchWithCredential. Cloud profile and Metro bridge requests use fetch's redirect follow, which drops Authorization on another origin. Cloud auth keeps its same-origin loop because a 307 resends the body. The companion follows no redirect on relayed requests because custom headers survive a cross-origin follow. - Delete the proxy's relayed Location. The daemon sends none. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Re: review of 071e33c, addressed at 8a7acf1. Fixed
Simplified
The redirect experiment output is in the PR description. The changed test files pass; CI is pending. |
This comment has been minimized.
This comment has been minimized.
…quests A followed redirect forwarded the bridge body cross-origin and accepted an https-to-http hop. redirect: 'manual' turns a redirect into the existing non-retryable HTTP failure. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Apex Sentinel · ✅ Approve · review of
|
| Where | Finding |
|---|---|
packages/react-native/src/companion/client-companion-local-relay.ts:27 |
🆕 Metro bridge relay still serves a LAN http dev server; only the socket is refused |
Reviewed with this repository's own Sentinel configuration (e52cd292f50f).
💬 Talking to Sentinel
In a finding's thread, reply with:
| Command | What it does |
|---|---|
@apex-sentinel-staging note <context> |
Adds context; Sentinel re-checks the cited code |
@apex-sentinel-staging pivot <why> |
Says the finding is wrong; Sentinel re-checks the cited code |
@apex-sentinel-staging like |
Marks the finding as useful |
@apex-sentinel-staging dislike <why> |
Marks it as not useful, so it is not raised again |
On this conversation, comment @apex-sentinel-staging review to run a full review once again.
There was a problem hiding this comment.
Apex Sentinel: 1 new finding on 98a5c09. The verdict and the full list are in the summary comment.
|
The three blocking points from the earlier review of 071e33c are closed at 98a5c09, but five same-origin redirect cases need a fix before merge. The rule: each credentialed request or relayed request below should follow a bounded same-origin redirect with the existing handling, check the initial transport, and never send to another origin. The security docs currently describe the refusal as intended for profile, bridge and registration requests and for dev server redirects, so please confirm that choice if a case should stay as it is, or update those lines with the fix. For each route, a test should show that a same-origin 307 reaches the final endpoint and that an off-origin redirect receives no request. A second independent pass found that the cloud profile GET likely fails on a same-origin HTTPS 307. The JSON reader rejects the response before it reads the profile, so cloud connect fails. The base code followed the redirect and saved the profile, and the earlier head also supported it. The GET should follow it, keep the initial transport check, and refuse an origin change before sending. A second independent pass found that the Metro bridge POST likely fails when A second independent pass found that companion registration likely treats an ordinary same-origin 307 as a terminal failure. The worker never opens the WebSocket, so the companion never registers. The base worker followed this redirect. The registration POST should do the same and still validate where the bearer goes. A second independent pass found that companion unregister likely ignores a same-origin 307. Shutdown then clears the local state, and the server registration stays in place without any signal. The unregister POST should reach the final endpoint during the existing shutdown call. A second independent pass found that the Metro relay likely returns a same-origin 307 and its Not blocking: these notes can be taken or left: if refusing every redirect on the cloud profile GET, bridge POST and companion register or unregister calls is kept on purpose, the "Breaking:" paragraph could say that same-origin redirects now fail too (the PR table already names this), and if the base behavior is preferred instead, fetch's default One open thread on relayed HTTP does not apply and can be resolved: a request without the listed credential headers carries no header credential and stays pinned to the local base origin, so refusing all LAN HTTP would break Metro on a LAN IP for no security gain. All 26 checks pass, and the required evidence is in place. The five redirect cases are what remains before merge. Not verified here: no tests were run, and regression test validity was judged only by reading the 071e33c code against each new test. Whether any real cloud or bridge deployment sends a same-origin redirect on the profile, bridge or register paths was not checked, so the real-world impact is not measured. The 20-redirect limit in undici was not measured on Node 22 or 24; it comes from the fetch spec and the PR author's note. The Apple runner route is unchanged since the earlier review, and its live evidence is still the author's report on 678a0c6, accepted at 071e33c. |
|
Closing in favour of a smaller design, decided with the maintainer and recorded as ADR 0041 (credential transport). The rule: before sending a first-party credential to an operator-configured URL, require https or loopback http. 0.21.x warns, 0.22 refuses, and |
Summary
A credential never goes over plain
httporwsto a host that is not loopback (127.0.0.0/8,::1,localhost), and no redirect carries it to another origin. Refusals come before anything is sent, withdetails.reason: insecure_credential_transport. Requests usefetchandnode:http. Loopback is safe by design: it stays on the host.Breaking: token-bearing
http://LAN or VPN URLs stop working, as does a plain non-loopback proxyupstreamBaseUrl. The proxy follows no upstream redirect. The Metro companion refuses relayed WebSockets to a LANhttpdev server and returns relayed redirects to the bridge. Use https orssh -L.Net lines: latest commit +442 −458; branch +1721 −181 (non-test source +417 −92).
Before / after
Security
fetchredirect: 'follow'between two local servers; identical on Node 26.11.1 and 22.12.0; noReferersent:Validation
At 8a7acf1: the six changed test files (81 tests) and OXC format and lint passed. Full gates last passed at 572b141; CI pending.
The live Wi-Fi iPhone check passed on 678a0c6. The runner now sends there through
fetch(unit-tested); not re-run live.🤖 Generated with Claude Code